/*
Java source file
Copyright: Umschalt.com 2012
*/
package com.david.documentation.web.view.pages;

import com.david.documentation.service.doku.DokuService;
import com.david.documentation.service.tag.TagService;
import com.david.documentation.web.BasePage;
import com.david.documentation.web.view.dataProvider.TagDataProvider;
import com.david.documentation.web.view.panels.SearchResultPanel;
import com.david.documentation.web.view.panels.TagPanel;
import org.apache.wicket.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;

public class TagPage extends BasePage{

	@SpringBean
	private TagService tagService;

	@SpringBean
	private DokuService dokuService;

	public TagPage(){
		this(null);
	}

	public TagPage(PageParameters parameters){
		String tag = "";
		if (parameters != null && parameters.containsKey("tag")){
			tag = parameters.get("tag").toString();
			add(new SearchResultPanel("panel",new TagDataProvider(tag,dokuService),tag));
		} else {
			add(new TagPanel("panel",tagService));
		}
	}
}
